package com.aletto.general_store.data;

import com.aletto.general_store.data.model.Address;
import com.aletto.general_store.data.model.AuctionGoods;
import com.aletto.general_store.data.model.AuctionPageGoods;
import com.aletto.general_store.data.model.ConsumerOrder;
import com.aletto.general_store.data.model.Goods;
import com.aletto.general_store.data.model.GoodsDetails;
import com.aletto.general_store.data.model.OrderCompany;
import com.aletto.general_store.data.model.OrderCreate;
import com.aletto.general_store.data.model.OrderDetails;
import com.aletto.general_store.data.model.OrderNumber;
import com.aletto.general_store.data.model.OrderScore;
import com.aletto.general_store.data.model.PageResponse;
import com.aletto.general_store.data.model.Response;
import com.aletto.general_store.data.model.SearchKeyword;
import com.aletto.general_store.data.model.ServiceOrder;
import com.aletto.general_store.data.model.Store;
import com.aletto.general_store.data.model.StoreFavorites;
import com.aletto.general_store.data.model.StoreOrder;
import com.aletto.general_store.data.model.Upload;
import com.aletto.general_store.data.model.UserDetails;
import com.sisyphus.spinach.core.model.IPageResponse;
import com.sisyphus.spinach.core.model.IResponse;

import java.io.File;
import java.util.List;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.MultipartBody;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;

public interface IDataSource {

    /**
     * 上传图片
     */
    Observable<Response<Upload>> upload(File file);

    /**
     * 门店详情
     */
    Observable<Response<Store>> getShopDetails(String id, int status);

    /**
     * 门店下的商品
     */
    Observable<Response<PageResponse<Goods>>> getGoodsByShopId(
            int page,
            int size,
            String shopId,
            int type,
            int orderType
    );

    /**
     * 首页推荐商品
     */
    Observable<Response<PageResponse<Goods>>> homeGoods(int page, int size);

    /**
     * 商品详情
     */
    Observable<Response<GoodsDetails>> getGoodsDetails(String id, int status);

    /**
     * 热门搜索
     */
    Observable<Response<List<String>>> hotSearch();

    /**
     * 搜索商品
     */
    Observable<Response<PageResponse<Goods>>> searchGoods(int page, int size, String keyword);

    /**
     * 搜索店铺
     */
    Observable<Response<PageResponse<Store>>> storeLists(int page, int size, String keyword);

    /**
     * 搜索提示
     */
    Observable<Response<List<String>>> searchPrompt(int type, String keyword);

    /**
     * 登录
     */
    Observable<Response<UserDetails>> login(String address);

    /**
     * 用户信息
     */
    Observable<Response<UserDetails>> userDetails();

    /**
     * 修改用户信息
     */
    Observable<Response<Object>> updateUserDetails(
            String id,
            String name,
            String head_img,
            String sign
    );

    /**
     * 收货地址列表
     */
    Observable<Response<List<Address>>> addressList();

    /**
     * 添加收货地址
     */
    Observable<Response<Object>> addAddress(String name, String phone, String address);

    /**
     * 删除收货地址
     */
    Observable<Response<Object>> deleteAddress(int id);

    /**
     * 设默认地址
     */
    Observable<Response<Object>> defaultAddress(int id);

    /**
     * 历史记录
     */
    Observable<Response<PageResponse<Goods>>> history(int page, int size);

    /**
     * 清除历史记录
     */
    Observable<Response<Object>> clearHistory(String id);


    /**
     * 我的订单，店铺订单，数量
     */
    Observable<Response<OrderNumber>> myOrderInfo();

    /**
     * 我的订单
     */
    Observable<Response<PageResponse<ConsumerOrder>>> myOrderList(
            int page,
            int size,
            int type,
            String keyword
    );

    /**
     * 店铺订单
     *
     * @param type 订单类型不传查全部，1待发货2待收货3评分4退款
     */
    Observable<Response<PageResponse<StoreOrder>>> shopOrderList(
            int page,
            int size,
            int type,
            String keyword
    );

    /**
     * 上传商品
     */
    Observable<Response<AuctionPageGoods>> myGoodsList(
            int page,
            int size,
            Integer status,
            String keyword
    );

    /**
     * 收藏商品
     */
    Observable<Response<Object>> favoritesGoods(String id, boolean isFavorites);

    /**
     * 收藏的商品列表
     */
    Observable<Response<PageResponse<Goods>>> favoritesGoodsList(int page, int size);

    /**
     * 收藏店铺
     */
    Observable<Response<Object>> favoritesStore(String id, boolean isFavorites);

    /**
     * 收藏的商品列表
     */
    Observable<Response<PageResponse<StoreFavorites>>> favoritesStoreList(int page, int size);

    /**
     * 清除收藏
     */
    Observable<Response<Object>> clearFavorites(int type);

//    /**
//     * 购买
//     */
//    Observable<Response<Object>> buy(String goodsId, int addressId, int number, String price, String address, int type);

    /**
     * 创建订单
     */
    Observable<Response<OrderCreate>> createOrder(String goods_id, int address_id, int num);

    /**
     * 支付金额
     */
    Observable<Response<Object>> payOrder(Long order_id, String pay_network, String pay_hash);

    /**
     * 订单详情
     */
    Observable<Response<OrderDetails>> orderDetails(String id);

    /**
     * 修改订单状态
     *
     * @param status 商品状态2-上架 3-下架
     */
    Observable<Response<Object>> upGoodsStatus(String id, int status);

    Observable<Response<PageResponse<OrderScore>>> getGoodsScoreList(
            String goods_id,
            int page,
            int size
    );

    /**
     * 发布商品
     */
    Observable<Response<Object>> addGoods(
            int type, // 1数字商品 2实物商品
            String name,
            String goods_img, // 图片（逗号隔开）
            String label,
            String desc, // 图片（逗号隔开）
            float price,
            int total_stock,
            String notice // 备注
    );

    /**
     * 发布商品
     */
    Observable<Response<Object>> updateGoods(
            String id,
            int type, // 1数字商品 2实物商品
            String name,
            String goods_img, // 图片（逗号隔开）
            String label,
            String desc, // 图片（逗号隔开）
            float price,
            int total_stock,
            String notice // 备注
    );

    Observable<Response<Object>> upGoodsPrice(String id, float price);

    Observable<Response<Object>> upGoodsStock(String id, int stock_type, int num);

    Observable<Response<Object>> delGoods(String id);

    /**
     * 发货
     *
     * @param send_id   物流单号,实物商品必填
     * @param send_code 物流公司编号,实物商品必填
     */
    Observable<Response<Object>> sendOrder(Long order_id, String send_id, String send_code);

    /**
     * 获取物流公司列表
     */
    Observable<Response<List<OrderCompany>>> logisticsList();

    Observable<Response<PageResponse<ServiceOrder>>> kefuOrderList(
            int page,
            int size,
            int type,
            String keyword
    );

    Observable<Response<Object>> confirmReceipt(Long order_id);

    Observable<Response<Object>> orderRating(Long order_id, Integer score);
}
